﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;

namespace SimpleRest.WebTest.Entities
{
    public class Product
    {
        private static Random random = new Random();
        public static Product GetMock(string id)
        {
            return new Product()
            {
                Id = id,
                Name = "Some Name - " + Guid.NewGuid().ToString(),
                Price = new Price()
                {
                    Currency = "USD",
                    Amount = (decimal)random.Next(1, 100)
                },
                Content = new Content()
                {
                    Description = "Some description here that is reaally long and descriptive " + Guid.NewGuid().ToString(),
                    ShortDescription = "Short Desc " + Guid.NewGuid().ToString(),
                    ImageUris = new List<string>()
                    {
                        "http://images.crestock.com/340000-349999/342739-xs.jpg",
                        "https://www.google.com/logos/2012/bram-stoker-2012-hp.jpg"
                    }
                }
            };
        }

        public string Id { get; set; }
        [Required(ErrorMessage = "The product name is required.")]
        public string Name { get; set; }
        [Required(ErrorMessage="The product price is required.")]
        public Price Price { get; set; }
        [Required(ErrorMessage = "The product content is required.")]
        public Content Content { get; set; }
        public DateTime? DateCreated { get; set; }

        public List<Content> AdditionalContent { get; set; }

        public List<Product> Children { get; set; }
        public Product Parent { get; set; }
    }
}